package com.luck.config;

import com.alibaba.fastjson.JSON;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Enumeration;

/**
 * 登陆拦截器
 * no login to login.html
 * Created by Hua wb on 2018/11/13.
 */
public class LoginInterceptor implements HandlerInterceptor {
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String user = (String) request.getSession().getAttribute("user");
        if (user == null) {
            // 未登录
            //response.sendRedirect("toLogin");
            return true;
        }
        return true;
    }
}
